//
//  ADChildViewController.h
//  Nooryes
//
//  Created by baken on 2020/2/28.
//  Copyright © 2020 MyApp. All rights reserved.
//

#import "ADChildViewController.h"
#import "NYTabBarController.h"


@interface ADChildViewController ()

@property (nonatomic, strong) WKWebView *webView;

@property (nonatomic, strong) NSString *urlString;

@end

@implementation ADChildViewController

- (instancetype)initWithURL:(NSString *)url{
    if (self = [super init]) {
        _urlString = url;
    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithWhite:0.1 alpha:1.0];
    WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    webView.backgroundColor = [UIColor whiteColor];
//    webView.scalesPageToFit = YES;
//    webView.delegate = self;
    webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.webView = webView;
    [self.view addSubview:self.webView];
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_urlString]]];
    
   
    self.navigationItem.leftBarButtonItems = nil;
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"newsClose"] style:UIBarButtonItemStylePlain target:self action:@selector(dissmissBarButton)];
    self.navigationItem.leftBarButtonItem = item;
}



- (void)dissmissBarButton{

    NYTabBarController *customeBar = [[NYTabBarController alloc] init];
    myDelegate.window.rootViewController =customeBar;
    myDelegate.tabbarController = customeBar;
    [myDelegate.window makeKeyAndVisible];
}


@end
